Modifying execution flow in save-to-return code scenarios

ABSTRACT

A computer-implemented method includes, in a code transformation system, identifying save-to-return code instructions, function call code instructions, comparison code instructions, and exceptional code instructions. The function call code instructions are associated with the save-to-return code instructions. The comparison code instructions are associated with the save-to-return code instructions. The exceptional code instructions are associated with the comparison code instructions. A predefined proximity range based on a predefined proximity value as well as a proximity eligibility indicator are determined. The proximity eligibility indicator denotes whether the save-to-return code instructions and the comparison code instructions are within the predefined proximity range. Responsive to the proximity eligibility indicator denoting the save-to-return code instructions and the comparison code instructions are within the predefined proximity range, one or more execution flow relationships between the function call code instructions and the exceptional code instructions are created. A corresponding computer program product and computer system are also disclosed.

BACKGROUND

The present invention relates generally to the field of codetransformation systems, and more particularly to modifying executionflow relationships estimated by those systems.

Code transformation systems (such as compilers, interpreters, and codeoptimizers) are widely used in facilitating computer execution. Codetransformation systems often estimate execution flow relationshipsbetween code instructions to assist in their execution flow analysis.Developers of those systems continue to face challenges in efficientlyestimating execution flow relationships between code instructions, suchas save-to-return code instructions.

SUMMARY

A computer-implemented method includes, in a code transformation system,identifying one or more save-to-return code instructions and identifyingone or more function call code instructions. The one or more functioncall code instructions are associated with the one or moresave-to-return code instruction. The computer-implemented method furtherincludes identifying one or more comparison code instructions. Thecomparison code instructions are associated with the one or moresave-to-return code instructions. The computer-implemented methodfurther includes identifying one or more exceptional code instructions.The exceptional code instructions are associated with the one or morecomparison code instructions. The computer-implemented method furtherincludes determining a predefined proximity range based on a predefinedproximity value and determining a proximity eligibility indicator. Theproximity eligibility indicator denotes whether the one or moresave-to-return code instructions and the one or more comparison codeinstructions are within the predefined proximity range. Thecomputer-implemented method further includes, responsive to theproximity eligibility indicator denoting the one or more save-to-returncode instructions and the one or more comparison code instructions arewithin the predefined proximity range, creating one or more executionflow relationships between the one or more function call codeinstructions and the one or more exceptional code instructions. Acorresponding computer program product and computer system are alsodisclosed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of one embodiment of a computer systemenvironment suitable for operation of an execution flow modificationprogram, in accordance with at least one embodiment of the presentinvention.

FIG. 2 is a data-flow diagram of an execution flow modification program,in accordance with at least one embodiment of the present invention.

FIG. 3 is a flow-chart diagram of an execution flow modificationprogram, in accordance with at least one embodiment of the presentinvention.

FIG. 4 is an operational example of a save-to-return code scenario, inaccordance with at least one embodiment of the present invention.

FIG. 5 is an operational example of code execution flow relationshipsproduced by a code transformation system, in accordance with at leastone embodiment of the present invention.

FIG. 6 is an operational example of modified code execution flowrelationships produced by an execution flow modification program, inaccordance with at least one embodiment of the present invention.

FIG. 7 is a block diagram of a computing apparatus suitable forexecuting an execution flow modification program, in accordance with atleast one embodiment of the present invention.

DETAILED DESCRIPTION

At least in some embodiments, the present invention modifies the codeexecution flow relationships produced by a code transformation systemwith respect to one or more code instructions comprising one or moresave-to-return code instructions. A code transformation system may be acompiler, an interpreter, a code optimizer, any combination of thementioned software platforms, or any other software platform thatanalyzes and/or estimates the execution flow of one or more codeinstructions. While some of the examples discussed in this documentexplain the present invention in computer system environments comprisinga compiler, a person of ordinary skill in the art readily appreciatesthat the present invention may be implemented in a computer systemenvironment comprising any code transformation system, as defined above(including any software platform that analyzes and/or estimates theexecution flow of one or more code instructions).

A save-to-return code instruction may be any code instruction that, inwhole or in part, saves some or all of the running environment of apoint in the execution flow of one or more code instructions. In atleast some embodiments, the running environment may in the future beused by one or more “jump-to-return” code instructions to restore codeexecution to a point after the execution of the save-to-return codeinstruction. While some of the examples discussed in this documentexplain the present invention with respect to setjmp and longjmp codeinstructions implemented in standard implementations of the Cprogramming language, a person of ordinary skill in the art readilyappreciates that the present invention may be implemented with respectto other save-to-return and/or jump-to-return code instructions, such assave-to-return and/or jump-to-return code instructions available inprogramming languages other than C.

FIG. 1 is a block diagram of one embodiment of a computer systemenvironment suitable for operation of an execution flow modificationprogram, in accordance with at least one embodiment of the presentinvention. In the computer system depicted in FIG. 1, a compilerexecution flow generator 120 uses the source code 121 to estimate and/orproduce one or more code execution flow relationships 122 between one ormore components of the source code 121. In some embodiments, thecompiler creates one or more execution flow relationships between blocksof source code, where a block comprises one or more code instructionsthat will, in successful executions of the source code, always beexecuted together (i.e. code instructions A and B are in the same blockif, during a successful execution of the code, every time A executes, Balso executes, and vice versa).

The computer system depicted in FIG. 1 also comprises one or more piecesof proximity information 123 and one or more pieces of exceptional codeidentification information 124. The execution flow modification program110 uses the proximity information 123 to determine whether it shouldmodify the code execution flow relationships 122. The program uses theexceptional code identification information 124 to determine which codeinstructions may be classified as “exceptional code instructions” asfurther discussed below. The program produces one or more modifiedexecution flow relationships 130.

FIG. 2 is a data flow diagram of an execution flow modification program,in accordance with at least one embodiment of the present invention. Inthe embodiment depicted in FIG. 2, the execution flow modificationprogram 110 analyzes the code execution flow relationships 122 to locatethe portions of the code execution flow relationships 122 associatedwith the execution flow of one or more save-to-return code instructions.The program produces one or more “annotated code execution flowrelationships” 210 that comprise one or more code execution flowrelationships associated with the execution flow of one or moresave-to-return code instructions. In some embodiments, the annotatedcode execution flow relationships 210 may comprise the code executionflow relationships 122 with one or more indications locating those codeexecution flow relationships associated with the execution flow of oneor more save-to-return code instructions.

In some embodiments, the code instructions associated with the executionflow of one or more save-to-return code instructions may comprise one ormore save-to-return code instructions, one or more jump-to-return codeinstructions, one or more function calls associated with thesave-to-return code instruction, one or more comparison codeinstructions, and/or one or more exceptional code instructions. In someembodiments, the code instructions associated with the execution flow ofone or more save-to-return code instructions may comprise the one ormore non-exceptional blocks of code associated with one or morecomparison code instructions.

In at least some embodiments, save-to-return code instructions and/or ajump-to-return code instructions may be associated with one or morevalues, such as one or more values returned by the save-to-return codeinstruction and/or one or more values supplied as arguments to one ormore jump-to-return code instructions. In some embodiments, a programmermay use one or more of the values associated with save-to-return codeinstructions and/or a jump-to-return code instructions to direct thecode execution flow after an execution of a save-to-return codeinstruction and/or after an execution of a jump-to-return codeinstruction associated with the save-to-return code instruction. In someembodiments, the aforementioned task of directing code execution flowusing values associated with one or more save-to-return codeinstructions and/or one or more jump-to-return code instructions may beaccomplished using a conditional statement hereby referred to as a“comparison code instruction.” In an exemplary embodiment, thecomparison code instruction comprises a conditional statement in the Cprogramming language (such as an if statement or a switch statement)that uses the value returned by the setjmp code instructions and/or thevalue supplied as an argument to the longjmp code instructions as itsconditional variable.

In at least some embodiments, the comparison code instruction isassociated with one or more blocks of code instruction that willconditionally be executed based on the one or more values associatedwith save-to-return and/or a jump-to-return code instructions (i.e. the“conditional variables” associated with the comparison codeinstruction). The execution flow modification program 110 identifiessome of those one or more blocks of code instruction as “exceptionalcode instructions.” In the embodiment depicted in FIG. 2, the program110 identifies the exceptional code instructions based on one or morepieces of exceptional code identification information 124. In anexemplary embodiment, the program 110 identifies one or more blocks ofcode associated with a comparison code instruction as exceptional codeinstructions if the regular execution of those blocks of code isassociated with the conditional variable associated with the comparisoncode instruction being non-zero. In some embodiments, the one or morepieces of the exceptional code identification information 124 aresupplied by one or more users of the program 110.

In the embodiment depicted in FIG. 2, the execution flow modificationprogram 110 uses proximity information 123 to determine one or moreproximity ranges 211. In at least some embodiments, the program 110 onlymodifies the code execution flow relationships 122 associated with thesource code 121 if a save-to-return instruction and its associatedcomparison code instruction are within a pre-defined proximity range211. A proximity range 211 may be defined based on a proximity value.The proximity value between two code instructions A and B, when Adominates B (i.e. when every path of execution flow to B from the pointof start of execution comprises executing A), is the number of codeinstructions (e.g. in the context of high level programming languages,source code instructions; in the context of intermediate-levelprogramming languages, intermediate language instructions; in thecontext of assembly language, assembly language instructions; in thecontext of machine language, machine language instructions) dominated byA and post-dominated by B (where X is post-dominated by B if every pathof execution flow from X to the point of end of execution flow comprisesexecuting B). In some embodiments, the program 110 determines aproximity range 211 based on proximity information 123 other than theproximity value, such as proximity information 123 obtained and/orderived from the code execution flow relationships 122 and/or theannotated code execution flow relationships 210.

In the embodiment depicted in FIG. 2, the execution flow modificationprogram 110 uses the proximity ranges 211 to determine which of the oneor more code execution flow relationships 122 need to be modified. Theprogram modifies the code execution relationships 122 and produces theone or more modified execution flow relationships 130.

FIG. 3 is a flowchart diagram of an execution flow modification program,in accordance with at least one embodiment of the present invention. Atstep 300, the program identifies one or more save-to-return codeinstructions. At step 301, the program identifies one or more functioncall code instructions associated with the one or more save-to-returncode instructions. At step 302, the program identifies one or morecomparison code instructions associated with the one or moresave-to-return code instructions. At step 303, the program identifiesone or more exceptional code instructions associated with the one ormore comparison code instructions. At step 304, the program determines apredefined proximity range based on a predefined proximity value. Atstep 305, the program determines a proximity eligibility indicatordenoting whether the one or more save-to-return code instructions andthe one or more comparison code instructions are within the pre-definedproximity range. At step 306, responsive to the proximity eligibilityindicator denoting that the one or more save-to-return code instructionsand the one or more comparison code instructions are within thepredefined proximity range 310, the program creates one or moreexecution relationships between the one or more function call codeinstructions and the one or more exceptional code instructions 311.

FIG. 4 is an operational example of a sequence of code instructionscomprising a save-to-return code instruction and a jump-to-return codeinstruction, in accordance with at least one embodiment of the presentinvention. In the source code sequence 400, written in accordance withthe syntax of a standard implementation of the C programming language,line 1 comprises a declaration of the main( ) function, which is theentry point of execution in standard implementations of the Cprogramming language. Line 2 comprises declaring a variable Environmentof the type jump_buf (i.e. capable of storing at least part of anexecution environment). Line 3 comprises declaring a variableReturnValue of the type int (i.e. capable of storing an integer value).Line 4 comprises initializing the Environment variable with theexecution environment present during an execution of that line, usingthe setjmp save-to-return code instruction. Line 4 also comprises codeinstructions storing the value returned by the setjmp code instructionin the ReturnValue variable.

In the operational example depicted in FIG. 4, the set jmp codeinstruction returns the value of zero in non-exceptional executions(i.e. executions of the non-exceptional code instructions associatedwith a comparison code instruction), and returns a non-zero value inexceptional executions (i.e. executions of the exceptional codeinstructions associated with a comparison code instruction). Line 5comprises a comparison code instruction in the form of an “if”statement. The comparison code instruction notes that if the value ofthe ReturnValue variable is zero (i.e., denoting a non-exceptionalexecution), then a call of the function Function( ) would occur in line6. If the value of the ReturnValue variable is non-zero, the exceptionalcode instructions marked by the else keyword on line 7 and enclosed bycurly braces on lines 7 and 8 will be executed. In the operationalexample depicted in FIG. 4, the exceptional code instructions comprise acall to a return( ) function, which here terminates execution of thecode instructions.

In the operational example depicted in FIG. 4, a non-exceptionalexecution of the source code sequence 400 assigns a value of zero to theReturnValue variable on line 4. Therefore, a call to Function( ) wouldoccur on line 6, leading to the execution of lines 11-13 of the sourcecode sequence 400. In line 11, the source code sequence 400 comprises adeclaration of Function( ). In Line 12, the source code sequence 400comprises the longjmp jump-to-return code instruction. In theoperational example depicted in FIG. 4, the first parameter of longjmpcode instructions denotes the execution environment that the longjmpcode instruction restores, and the second parameter of the longjmp codeinstruction (if any) denotes the value assigned to the variable that isalso target of an assignment by the execution of the setjmp codeinstruction associated with the execution environment being restored(i.e. the value assigned to the ReturnValue variable).

In the operational example depicted in FIG. 4, the longjmp codeinstruction in line 12 assigns the value 1, a non-zero value, to theReturnValue variable. Therefore, upon restoration of the executionenvironment to the environment present immediately after the executionpoint when the Environment variable was last assigned a value (i.e.,line 5, immediately after line 4 that includes the setjmp statementwhich initialized the Environment variable), the execution flowtransitions to the exceptional code instructions, here the return( )function call code instruction on line 8. In the operational exampledepicted in FIG. 4, if the second parameter of the longjmp codeinstruction in line 12 was zero, or if the longjmp code instruction inline 12 had no second parameter, the execution flow may have entered aloop and may never have executed the one or more exceptional codeinstructions. In fact, during successful executions, the execution flowmay only reach one or more exceptional code instructions through alongjmp code instruction in the one or more non-exceptional code blocksthat changes the value of the ReturnValue variable, and not through theinitial execution of the comparison code instruction following theexecution of the set jmp code instruction.

FIG. 5 is an operational example of code execution flow relationshipsproduced by a code transformation system for lines 1-10 of the codesequence 400. In the operational example depicted in FIG. 5, executionflow relationship 550 moves the execution flow from the point of startof execution 500 to the code instructions preceding the comparison codeinstruction 501 (i.e. code instructions in lines 1-4, including theinitialization of the ReturnValue variable by the return value of theset jmp code instruction in line 4). Importantly, the preceding code 501instructions comprise a save-to-return code instruction (i.e. the setjmpcode instruction on line 4 of code sequence 400 in FIG. 4). Executionflow relationship 551 moves the execution flow from the codeinstructions preceding the comparison code instruction 501 to thecomparison code instruction 502 starting at line 5. Execution flowrelationship 552 moves the execution flow from the comparison codeinstruction 502 to the call of the Function( ) 503 at line 6. In theoperational example depicted in FIG. 5, execution flow relationship 552will only be executed if the value of the ReturnValue variable is zero.The code execution flow relationship 553 moves the execution flow fromthe comparison code 502 to the exceptional code 504 at line 8, if thevalue of ReturnValue variable is nonzero. Execution flow relationship554 move the execution flow from the call of Function( ) 503 to thepoint of the end of the execution 505. Execution flow relationship 555moves the execution flow from the exceptional code 504 to the point ofthe end of the execution 505.

In constructing the code execution flow relationships depicted in theoperational example of FIG. 5, a compiler may assume that some or all offunction call code instructions in the non-exceptional code instructionsassociated with a comparison code instruction (such as the call of theFunction( ) 503 in line 6) may include one or more jump-to-return codeinstructions, such as one or more longjmp code instruction. To addressthis possibility, the compiler will create one or more code executionflow relationships between some or all of function call codeinstructions and one or more save-to-return code instructions (and/orone or more comparison code instructions). Such code execution flowrelationships may move in a reverse direction relative to the generaldirection of the program execution from the point of the entry ofexecution 500 to the point of the end of the execution 505. In theoperational example depicted in FIG. 5, the code execution flowrelationship 560 is an example of such a “reverse code execution flowrelationship.” The creation of such reverse code execution flowrelationships (and the cycle they create in the overall code executionflow representation of a sequence of code instructions) may complicatethe code execution flow analysis performed by the compiler using theoverall code execution flow representation. This, in turn, may lead tohigher compilation time and less effective optimization of codeexecution.

In at least some embodiments, a jump-to-return code instruction (such asthe code instruction on line 12) will not itself be represented in theone or more execution flow relationships and will instead be assumed tobe performed by one or more function call code instructions (such as thefunction call on line 6).

FIG. 6 is an operational example of modified code execution flowrelationships produced by an execution flow modification program. In theoperational example depicted in FIG. 6, the program has removed thereverse code execution flow relationship 560 (marked by dotted lines,indicating removal of a code execution flow relationship). In addition,the program has also removed the code execution flow relationship 553between the comparison code instructions 502 and the exceptional codeinstructions 504. The program has created a new execution flowrelationship 660 between the Function( ) call 503 and the exceptionalcode instructions 504 (marked by a bold line, indicating creation of anexecution flow relationship). This improved overall code execution flowrepresentation of the code instructions avoids the potentialcomplications and inefficiencies brought about by the presence ofreverse execution flow relationships in the execution flow picture ofthe one or more code instructions.

In some embodiments, the execution flow modification program identifiesone or more save-to-return code instructions, one or more function callcode instructions, one or more comparison code instructions, and one ormore exceptional code instructions based on the identifying informationdirectly or indirectly provided by a code transformation system and/orby the rules of a programming language and/or coding platform. Theprogram uses those identifications to determine a predefined proximityrange and a proximity eligibility indicator, and to create one or moreexecution flow relationships between the one or more save-to-return codeinstructions and the one or more function call code instructionsresponsive to the proximity eligibility indicator.

In other embodiments, the execution flow modification program identifiesthe code instructions of the various types mentioned above based on thebehavior of one or more code instructions and/or the code execution flowrelationships corresponding to one or more code instructions. In anexemplary embodiment, the program analyzes the code execution flowrelationships of a sequence of one or more source code instructions anddetermines that a statement saving the execution environment of theprogram is a save-to-return code instruction. The program uses thosebehavior-based identifications to determine a predefined proximity rangeand a proximity eligibility indicator, and to create one or moreexecution flow relationships between the one or more save-to-return codeinstructions and the one or more function call code instructionsresponsive to the proximity eligibility indicator. In some embodiments,the execution flow modification program will determine that some codeinstructions that do not exhibit all of the properties of asave-to-return code instruction (e.g. one or more “jump” codeinstructions) may nevertheless be identified as a save-to-return codeinstruction if their code execution flow behavior at least in partcorresponds to that of one or more save-to-return code instructions.

The execution flow modification program identifies one or moresave-to-return code instructions at step 300. A save-to-return codeinstruction may be any code instruction that, in whole or in part, savessome or all of the running environment of a point in the execution flowof one or more code instructions. In at least some embodiments, therunning environment may in the future be used by one or morejump-to-return code instructions to restore code execution to a point ator immediately after the execution of the save-to-return codeinstruction, along with restoring some or all of the executionenvironment to the environment present during or immediately after theinitial execution of the save-to-return code instruction. In at leastsome embodiments, save-to-return code instructions and/or ajump-to-return code instructions may be associated with one or morevalues, such as one or more values returned by the save-to-return codeinstruction and/or one or more values supplied as arguments to one ormore jump-to-return code instructions. In some embodiments, a programmermay use one or more of the values associated with save-to-return codeinstructions and/or a jump-to-return code instructions to direct thecode execution flow after the execution of a save-to-return codeinstruction. In some embodiments, the one or more save-to-return codeinstructions comprise one or more set jmp code instructions. In someembodiments, the one or more jump-to-return code instructions compriseone or more long j mp code instructions.

The execution flow modification program identifies one or more functioncall code instructions associated with the one or more save-to-returncode instructions at step 301. A function call code instruction may beany code instruction that, in whole or in part, causes the execution ofone or more code instructions grouped together and/or defined in someway as part of the same functional unit of code execution by theprogrammer and/or rules of one or more programming languages and/or oneor more coding platforms. A function call code instruction may be thecall of a procedure, method, function, subroutine, any combination ofthose constructs, or any other sequence of one or more code instructionsgrouped together and/or packaged as a unit of execution. Examples of afunction call code instruction include a call of a procedure in COBOL, acall of a method in Java®, and a call of a function in C. A functioncall code instruction may comprise any call of or reference to ananonymous function, such as a lambda function. In some embodiments, oneor more function call code instructions are associated with one or moresave-to-return code instruction if the one or more function call codeinstructions are potentially reachable by the execution flow path afteran execution of the one or more save-to-return code instructions. Insome embodiments, one or more function call code instructions areassociated with one or more save to return code instruction if thefunction call code instructions are dominated by the execution flow pathafter an execution of one or more save-to-return code instructions. Insome embodiments, each of one or more function calls in one or more codeinstruction collections and/or one or more code instruction files areconsidered to be associated with each of the one or more save-to-returncode instructions in the one or more code instruction collections and/orone or more code instruction files.

The execution flow modification program identifies one or morecomparison code instructions associated with the one or moresave-to-return code instruction at step 302. A comparison codeinstruction may be any code instruction that, in whole or in part,causes the conditional execution of one or more blocks of code based onone or more values associated with one or more save-to-return codeinstructions and/or one or more values associated with one or morejump-to-return code instructions. The comparison performed by acomparison code instruction may be Boolean (e.g. binary), numeric (e.g.integer and/or floating point), or any other mode of comparison usingany other high-level, intermediate-level, low-level, or machine codeconstruct accomplishing the task of conditional execution of and/orconditional control flow transfer to one or more blocks of code. Itshould be noted that the term block as used in this document refers toone or more code instructions that will, in successful executions of thesource code, always be executed together. As such, the notion isextensible to any programming languages and/or coding platforms that donot explicitly support concepts associated with marking and/or handlingblocks of code.

The execution flow modification program identifies one or moreexceptional code instructions associated with the comparison codeinstructions at step 303. In some embodiments, the program identifiesother code instructions, such as one or more jump-to-returninstructions. In identifying one or more code instructions of varioustypes (e.g. one or save-to-return code instructions, one or morejump-to-return code instructions, one or more comparison codeinstructions, one or more exceptional code instructions, one or morenon-exceptional code blocks associated with one or more comparison codeinstructions, and/or one or more function call code instructions, etc.),the program may use any information produced by one or more softwareplatforms (including code execution flow relationships and/or annotatedcode execution flow relationships produced by a code transformationsystem).

In some embodiments, to identify code instructions of various types insource code and/or among one or more execution flow relationshipsestimated based on the source code, the execution flow modificationprogram may use one or more of any information produced by one or moresoftware platforms, historic execution data generated and/or stored bythe program or other one or more software platforms, rules ofprogramming languages and/or coding platforms, hardware platformproperties, hardware instruction set architecture, and any otherinformation that directly or indirectly provide information aboutidentifying code instructions of various types in source code and/oramong one or more execution flow relationships estimated based on sourcecode. Existing compilation and code transformation technologiesavailable in the art enable a person of ordinary skill in the art toidentify code instructions of various types in source code and/or amongone or more execution flow relationships estimated based on source code.

The execution flow modification program determines a predefinedproximity range based on a predefined proximity value at step 304. Insome embodiments, the program solely considers the predefined proximityvalue in determining a predefined proximity range. In an exemplaryembodiment, given a predefined proximity value of 2, the programdetermines the predefined proximity range to be the area between asave-to-return code instruction and the second code instruction beingdominated by the save-to-return code instruction (including thesave-to-return code instruction and the second code instruction).

In some embodiments, the execution flow modification program considersfactors in addition to the proximity value, such as the number, type,and/or function of the code instructions dominated by one or moresave-to-return code instructions and post-dominated by the one or morecomparison code instructions associated with the one or moresave-to-return code instruction in determining a pre-defined proximityrange. In some embodiments, the program ignores code instructions otherthan function call code instructions in determining the predefinedproximity range based on a proximity value. In an exemplary embodiment,given a predefined proximity value of 2, the program determines thepredefined proximity range to be the area between the save-to-returncode instruction and the second function call code instructionassociated with the save-to-return code instruction (including thesave-to-return code instruction and the second function call codeinstruction). In at least some of those embodiments, the program mayhave a predefined proximity range that spans to the point of the end ofthe program execution if the number of function calls (or otherspecified, qualifying code instructions) associated with the initialexecution of the save-to-return code instruction is less than thepredefined proximity value.

In some embodiments, the predefined proximity value is zero. In at leastsome of those embodiments, the execution flow modification programdetermines a proximity eligibility indicator denoting that one or moresave-to-return code instructions and one or more comparison codeinstruction are within a pre-defined proximity range if the one or moresave-to-return code instructions are immediate neighbors of the one ormore comparison code instructions (e.g. if no code instruction isdominated by the one or more save-to-return code instructions andpost-dominated by the one or more comparison code instructions). In atleast some of those embodiments, the modified execution flowrelationships produced by the execution flow modification program areguaranteed to estimate the execution flow of a sequence of one or morecode instructions comprising one or more save-to-return codeinstructions in a way that addresses the possibility of the presence ofjump-to-return code instructions in all function calls associated witheach of the one or more set-to-return code instructions. In someembodiments, the execution flow modification program determines aproximity eligibility indicator denoting that one or more save-to-returncode instructions and one or more comparison code instruction are withina pre-defined proximity range if the one or more save-to-return codeinstructions are in the same block of code as the one or more comparisoncode instructions.

In some embodiments, the execution flow modification program identifiesone or more intervening code instructions that are dominated by the oneor more save-to-return code instructions and post-dominated by the oneor more comparison code instructions. In those embodiments, thepredefined proximity indicator is determined without considering the oneor more intervening code instructions and the one or more exceptionalcode instructions comprise the one or more intervening codeinstructions. In at least some of those embodiments, the program ignoresany code instructions dominated by the one or more save-to-return codeinstructions and post-dominated by the one or more comparison codeinstructions in calculating a predefined proximity range, which leads toa proximity eligibility indicator denoting that the one or moresave-to-return code instructions and the one or more comparison codeinstructions are within a predefined proximity range if the predefinedproximity value is zero or positive. In at least some of thoseembodiments, the program considers the code instructions dominated bythe one or more save-to-return code instructions and post-dominated bythe one or more comparison code instructions to be part of theexceptional code instructions.

The execution flow modification program determines a proximityeligibility indicator at step 305. The proximity eligibility indicatordenotes whether the one or more save-to-return code instructions and theone or more comparison code instructions are within the predefinedproximity range. In some embodiments, determining a proximityeligibility indicator comprises identifying one or more post-save codeinstructions, where the one or more post-save code instructions compriseas many code instructions as the predefined proximity value and the oneor more post-save code instructions are dominated by the one or moresave-to-return code instructions. In at least some of those embodiments,determining a proximity eligibility indicator further comprisesdetermining whether the one or more post-save code instructions comprisethe one or more comparison code instructions. In at least some of thoseembodiments, the program counts the number of code instructionsdominated by an initial execution of a save-to-return code instruction.If the count reaches the value equal to the predefined proximity valueand the program has not found a comparison code instruction associatedwith the save-to-return code instruction since the start of itscounting, the program determines a proximity eligibility indicatordenoting that the save-to-return instruction and the comparison codeinstruction are not within the predefined proximity range. In some ofthose embodiments, the program may ignore some or all types of codeinstructions in its counting. In some of those embodiments, the programmay always determine a proximity eligibility indicator denoting that oneor more save-to-return code instructions and one or more comparison codeinstructions are within a predefined proximity range.

In some embodiments, determining a proximity eligibility indicatorcomprises identifying one or more intervening code instructions beingdominated by the one or more save-to-return code instructions and beingpostdominated by the one or more comparison code instructions,determining an intervening code instruction length indicating how manycode instructions the one or more intervening code instructionscomprise, and comparing the intervening instruction length and thepredefined proximity value. In at least some of those embodiments, theexecution flow modification program locates a comparison codeinstruction being dominated by a save-to-return code instruction. Theprogram counts the number of the intervening code instructions beingdominated by the save-to-return code instruction and post-dominated bythe comparison code instruction. If the count value is greater than thepredefined proximity value, the program determines a proximityeligibility indicator denoting that the save-to-return instruction andthe comparison code instruction are not within the predefined proximityrange; if the count value is not greater than the predefined proximityvalue, the program determines a proximity eligibility indicator denotingthat the save-to-return instruction and the comparison code instructionare within the predefined proximity range. In at least some of thoseembodiments, the program locates the one or more comparison codeinstructions.

In general, different embodiments of the present invention may usedifferent methods of determining a proximity eligibility indicator,depending on one or more of the information, the guidelines, and/or thecriteria used to determine the predefined proximity range, thecapabilities of the hardware platform and the programming languageand/or coding platform used, and the implementation choices specific tothe needs, desires, and/or the resources at hand. In some embodiments,the execution flow modification program identifies the starting pointand the ending point of the predefined proximity range, where thestarting point of the predefined proximity range is a point in the codeexecution flow of one or more code instructions that dominates all thecode instructions in the predefined proximity range and the ending pointof the predefined proximity range is a point in the code execution flowthat post-dominates all the code instructions in the predefinedproximity range. The program determines if one or more save-to-returncode instructions and one or more comparison-code instructions dominatedby the one or more save-to-return code instructions are within the areabetween the starting and the ending point (excluding the starting pointand the ending point). In some embodiments, the program will alwaysdetermine a proximity eligibility indicator denoting that one or moresave-to-return code instructions and one or more comparison codeinstructions are within a predefined proximity range.

Responsive to the proximity eligibility indicator denoting the one ormore save-to-return code instructions and the one or more comparisoncode instructions are within the predefined proximity range 310, theexecution flow modification program creates one or more execution flowrelationships between the one or more function call code instructionsand the one or more exceptional code instructions 311 at step 306. Insome embodiments, the program removes the reverse execution flowrelationships between the one or more function call code instructionsand the one or more save-to-return code instructions. In someembodiments, the program removes the execution flow relationshipsbetween the one or more save-to-return code instructions and the one ormore exceptional code instructions. In some embodiments, the one or moresave-to-return code instructions dominate the one or more comparisoncode instructions, and the one or more comparison code instructionspostdominate the one or more save-to-return code instructions. In someembodiments, the program removes one or more reverse execution flowrelationships between the one or more function call code instructionsand one or more code instructions selected from the group consisting of:(i) the one or more save-to-return code instructions and (ii) the one ormore comparison code instructions.

A code instruction may comprise one or more instructions to any one ormore computer hardware components and/or any one or more computersoftware components, including one or more instructions in a high-levelprogramming language (including a high-level language integrated withone or more application programming interfaces), intermediateprogramming language, assembly language, machine language, microcode,millicode, etc. Code instructions comprising one or more save-to-returnand/or one or more jump-to-return code instructions may enable complexcontrol flow modification, including of the kind used for exceptionhandling in many programming languages and/or coding platforms.

Removing reverse execution flow relationships from the overall codeexecution flow representation of one or more code instructionscomprising one or more save-to-return code instructions may reduce codetransformation time, such as compilation time, by simplifying theoverall code execution flow representation of the code instructions. Inaddition, creating code execution flow relationships between one or morefunction call code instructions and one or more exceptional codeinstructions to replace the reverse execution flow relationships betweenone or more function call code instructions and one or moresave-to-return code instructions may remove the need for execution ofthe one or more save-to-return code instructions following execution ofone or more jump-to-return code instructions, and thus may reduceexecution time. Nevertheless, the aforementioned advantages are notrequired to be present in all of the embodiments of the invention andmay not be present in all of the embodiments of the invention.

FIG. 7 is a block diagram depicting components of a computer 700suitable for executing the execution flow modification program. FIG. 7displays the computer 700, the one or more processor(s) 704 (includingone or more computer processors), the communications fabric 702, thememory 706, the RAM, the cache 716, the persistent storage 708, thecommunications unit 710, the I/O interfaces 712, the display 720, andthe external devices 718. It should be appreciated that FIG. 7 providesonly an illustration of one embodiment and does not imply anylimitations with regard to the environments in which differentembodiments may be implemented. Many modifications to the depictedenvironment may be made.

As depicted, the computer 700 operates over a communications fabric 702,which provides communications between the cache 716, the computerprocessor(s) 704, the memory 706, the persistent storage 708, thecommunications unit 710, and the input/output (I/O) interface(s) 712.The communications fabric 702 may be implemented with any architecturesuitable for passing data and/or control information between theprocessors 704 (e.g. microprocessors, communications processors, andnetwork processors, etc.), the memory 706, the external devices 718, andany other hardware components within a system. For example, thecommunications fabric 702 may be implemented with one or more buses or acrossbar switch.

The memory 706 and persistent storage 708 are computer readable storagemedia. In the depicted embodiment, the memory 706 includes a randomaccess memory (RAM). In general, the memory 706 may include any suitablevolatile or non-volatile implementations of one or more computerreadable storage media. The cache 716 is a fast memory that enhances theperformance of computer processor(s) 704 by holding recently accesseddata, and data near accessed data, from memory 706.

Program instructions for the execution flow modification program may bestored in the persistent storage 708 or in memory 706, or moregenerally, any computer readable storage media, for execution by one ormore of the respective computer processors 704 via the cache 716. Thepersistent storage 708 may include a magnetic hard disk drive.Alternatively, or in addition to a magnetic hard disk drive, thepersistent storage 708 may include, a solid state hard disk drive, asemiconductor storage device, read-only memory (ROM), electronicallyerasable programmable read-only memory (EEPROM), flash memory, or anyother computer readable storage media that is capable of storing programinstructions or digital information.

The media used by the persistent storage 708 may also be removable. Forexample, a removable hard drive may be used for persistent storage 708.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer readable storage medium that is also part of the persistentstorage 708.

The communications unit 710, in these examples, provides forcommunications with other data processing systems or devices. In theseexamples, the communications unit 710 may include one or more networkinterface cards. The communications unit 710 may provide communicationsthrough the use of either or both physical and wireless communicationslinks. The execution flow modification program may be downloaded to thepersistent storage 708 through the communications unit 710. In thecontext of some embodiments of the present invention, the source of thevarious input data may be physically remote to the computer 700 suchthat the input data may be received and the output similarly transmittedvia the communications unit 710.

The I/O interface(s) 712 allows for input and output of data with otherdevices that may operate in conjunction with the computer 700. Forexample, the I/O interface 712 may provide a connection to the externaldevices 718, which may include a keyboard, keypad, a touch screen,and/or some other suitable input devices. External devices 718 may alsoinclude portable computer readable storage media, for example, thumbdrives, portable optical or magnetic disks, and memory cards. Softwareand data used to practice embodiments of the present invention may bestored on such portable computer readable storage media and may beloaded onto the persistent storage 708 via the I/O interface(s) 712. TheI/O interface(s) 712 may similarly connect to a display 720. The display720 provides a mechanism to display data to a user and may be, forexample, a computer monitor.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instructions by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the blocks may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

1.-7. (canceled)
 8. A computer program product, comprising: one or morecomputer readable storage media and program instructions stored on saidone or more computer readable storage media, said program instructionscomprising instructions to, in a code transformation system: identifyone or more save-to-return code instructions; identify one or morefunction call code instructions, said one or more function call codeinstructions being associated with said one or more save-to-return codeinstructions; identify one or more comparison code instructions, saidone or more comparison code instructions being associated with said oneor more save-to-return code instructions; identify one or moreexceptional code instructions, said one or more exceptional codeinstructions being associated with said one or more comparison codeinstructions; determine a predefined proximity range based on apredefined proximity value; determine a proximity eligibility indicator,said proximity eligibility indicator denoting whether said one or moresave-to-return code instructions and said one or more comparison codeinstructions are within said predefined proximity range; and responsiveto said proximity eligibility indicator denoting said one or moresave-to-return code instructions and said one or more comparison codeinstructions are within said predefined proximity range, create one ormore code execution flow relationships between said one or more functioncall code instructions and said one or more exceptional codeinstructions.
 9. The computer program product of claim 8, wherein saidpredefined proximity value is zero.
 10. The computer program product ofclaim 8, wherein said one or more save-to-return code instructionscomprise one or more setjmp code instructions.
 11. The computer programproduct of claim 8, wherein said program instructions further compriseinstructions to: remove one or more reverse execution flow relationshipsbetween said one or more function call code instructions and one or morecode instructions selected from the group consisting of said one or moresave-to-return code instructions and said one or more comparison codeinstructions.
 12. The computer program product of claim 8, wherein saidinstructions to determine said proximity eligibility indicator compriseinstructions to: identify one or more post-save code instructions, saidone or more post-save code instructions comprising as many codeinstructions as said predefined proximity value and being dominated bysaid one or more save-to-return code instructions; and determine whethersaid one or more post-save code instructions comprise said one or morecomparison code instructions.
 13. The computer program product of claim8, wherein said instructions to determine said proximity eligibilityindicator comprise instructions to: identify one or more interveningcode instructions, said one or more intervening code instructions beingdominated by said one or more save-to-return code instructions andpostdominated by said one or more comparison code instructions;determine an intervening code instruction length, said intervening codeinstruction length indicating how many code instructions said one ormore intervening code instructions comprise; and compare saidintervening code instruction length and said predefined proximity value.14. The computer program product of claim 8, wherein: said one or moresave-to-return code instructions dominate said one or more comparisoncode instructions; and said one or more comparison code instructionspostdominate said one or more save-to-return code instructions.
 15. Acomputer system comprising: a processor; one or more computer readablestorage media; computer program instructions; said computer programinstructions being stored on said one or more computer readable storagemedia; and said computer program instructions comprising instructionsto: identify one or more save-to-return code instructions; identify oneor more function call code instructions, said one or more function callcode instructions being associated with said one or more save-to-returncode instructions; identify one or more comparison code instructions,said one or more comparison code instructions being associated with saidone or more save-to-return code instructions; identify one or moreexceptional code instructions, said one or more exceptional codeinstructions being associated with said one or more comparison codeinstructions; determine a predefined proximity range based on apredefined proximity value; determine a proximity eligibility indicator,said proximity eligibility indicator denoting whether said one or moresave-to-return code instructions and said one or more comparison codeinstructions are within said predefined proximity range; and responsiveto said proximity eligibility indicator denoting said one or moresave-to-return code instructions and said one or more comparison codeinstructions are within said predefined proximity range, create one ormore code execution flow relationships between said one or more functioncall code instructions and said one or more exceptional codeinstructions.
 16. The computer system of claim 15, wherein saidpredefined proximity value is zero.
 17. The computer system of claim 15,wherein said one or more save-to-return code instructions comprise oneor more setjmp code instructions.
 18. The computer system of claim 15,wherein said computer program instructions further comprise instructionsto: remove one or more reverse execution flow relationships between saidone or more function call code instructions and one or more codeinstructions selected from the group consisting of said one or moresave-to-return code instructions and said one or more comparison codeinstructions.
 19. The computer system of claim 15, wherein saidinstructions to determine said proximity eligibility indicator compriseinstructions to: identify one or more post-save code instructions, saidone or more post-save code instructions comprising as many codeinstructions as said predefined proximity value and being dominated bysaid one or more save-to-return code instructions; and determine whethersaid one or more post-save code instructions comprise said one or morecomparison code instructions.
 20. The computer system of claim 15,wherein said instructions to determine said proximity eligibilityindicator comprise instructions to: identify one or more interveningcode instructions, said one or more intervening code instructions beingdominated by said one or more save-to-return code instructions andpostdominated by said one or more comparison code instructions;determine an intervening code instruction length, said intervening codeinstruction length indicating how many code instructions said one ormore intervening code instructions comprise; and compare saidintervening instruction length and said predefined proximity value.